home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-28 | 3.0 KB | 115 lines | [TEXT/PJMM] |
- unit NSHC;
-
- { ================================================== }
-
- { nshc.p - a pascal interface for nShell (tm) commands. }
-
- { Copyright ( c ) 1994 Newport Software Development }
-
- { You may distribute unmodified copies of this file for noncommercial }
- { purposes . You may use this file as a reference when writing your }
- { own nShell ( tm ) commands . }
-
- { All other rights are reserved . }
-
- { ================================================== }
-
- interface
-
- { ================================================== }
-
- const
-
- { The version of this file. }
-
- NSHC_VERSION = 10;
-
- { common error definitions }
-
- NSHC_NO_ERR = 0;
- NSHC_ERR_GENERAL = -1;
- NSHC_ERR_VERSION = -2;
- NSHC_ERR_PARMS = -3;
- NSHC_ERR_MEMORY = -4;
- NSHC_ERR_FILE = -5;
-
- { limits to data structures }
-
- MAX_ARGS = 100;
- LINE_MAX = 2048;
-
- ARG_ARRAY = MAX_ARGS - 1;
- LINE_ARRAY = LINE_MAX - 1;
-
- { misc. }
-
- RETURN_CHAR = CHR(13);
-
- type
-
- { these states define command action }
-
- t_nsh_state = (nsh_idle, nsh_start, nsh_continue, nsh_stop);
-
- { this parameter block defines data passed: application <--> command }
-
- t_nshc_rec = record
- version: integer;
- action: t_nsh_state;
- result: integer;
- argc: integer;
- argv: array[0..ARG_ARRAY] of integer;
- arg_buf: packed array[0..LINE_ARRAY] of char;
- data: Handle;
- end;
-
- { misc. types }
-
- t_nshc_parms = ^t_nshc_rec;
- t_nshc_calls = Ptr;
-
- { ================================================== }
-
- { Interfaces to nShell callback routines. }
-
- { output to stderr }
-
- procedure NSH_putchar_err (nshc_calls: t_nshc_calls; c: char);
- procedure NSH_puts_err (nshc_calls: t_nshc_calls; c_string: ptr);
- procedure NSH_putStr_err (nshc_calls: t_nshc_calls; s: Str255);
-
- { output to stdout }
-
- procedure NSH_putchar (nshc_calls: t_nshc_calls; c: char);
- procedure NSH_puts (nshc_calls: t_nshc_calls; c_string: ptr);
- procedure NSH_putStr (nshc_calls: t_nshc_calls; s: Str255);
-
- { input from stdin }
-
- function NSH_getchar (nshc_calls: t_nshc_calls): integer;
- function NSH_gets (nshc_calls: t_nshc_calls; c_string: ptr; size: integer): integer;
- function NSH_getStr (nshc_calls: t_nshc_calls; s: Str255): integer;
-
- { variable access functions }
-
- function NSH_var_set (nshc_calls: t_nshc_calls; name: Str32; value: Str255): integer;
- function NSH_var_unset (nshc_calls: t_nshc_calls; name: Str32): integer;
- function NSH_var_env (nshc_calls: t_nshc_calls; name: Str32; value: Str255): integer;
-
- { path expansion functions }
-
- function NSH_path_expand (nshc_calls: t_nshc_calls; path: Str255): integer;
- function NSH_path_to_FSSpec (nshc_calls: t_nshc_calls; pathname: Str255; spec: FSSpecPtr): integer;
- function NSH_path_which (nshc_calls: t_nshc_calls; path: Str255): integer;
-
- { dialog functions }
-
- procedure NSH_notify (nshc_calls: t_nshc_calls; s: Str255; size: integer);
- function NSH_ask (nshc_calls: t_nshc_calls; s: Str255; size: integer): integer;
-
- { misc }
-
- function NSH_match (nshc_calls: t_nshc_calls; pattern: Str255; target: Str255): integer;
-
- implementation
- end.